<span id="s_p_btn">
<ul class="btn fr">
	<li><a class="btn_share b_share" href="#">Share</a></li>
	<li><a class="btn_print" href="#">Print</a></li>
</ul>
<!--share start-->
<div style="display:none" class="share">
	<div class="share_close"><a href="#" onclick="return false;"></a></div>
	<input type="text" value="0" readonly="readonly" name="linkurl">
	<a class="share_copy font_neo" href="javascript:void(0)">Copy Direct Link</a>
	<h3></h3>
	<h3 style="margin-top: -5px;">To E-mail</h3>
	<input type="text" name="toemail">
	<textarea></textarea>
	<input width="224" height="26" type="button"  class="send font_neo" value="Send">
</div>
<!--share end-->
</span>
<script type="text/javascript" charset="utf-8">
var p = $('#s_p_btn');

$('input[name=linkurl]', p).val(location.href);
$('textarea', p).val(location.href);


$('.btn_print').click(function(){
  try {
    window.print();
  } catch (err) {
    alert("Print error");
  }

  return false;
});

$('.share_close a', p).click(function(){
  $('.b_share').removeClass('btn_share_cur').addClass('btn_share');
  $('.share', p).slideUp();
  return false;
});

$('.b_share').click(function(){
  p.parent().css('position', 'relative');

  if ($(this).hasClass('btn_share_cur')) {
    $(this).removeClass('btn_share_cur').addClass('btn_share');
    $('.share', p).slideUp();
  } else {
    $(this).removeClass('btn_share').addClass('btn_share_cur');
    $('.share', p).slideDown();
  }
  return false;
});
</script>



<script type="text/javascript" charset="utf-8" src="js/share.js"></script>
<!--share start-->
<div style="display:none" class="share" id="sharePanel">
  <span class="msg" id="shareMessage"></span>
	<div class="share_close"><a href="#" id="shareClose" onclick="return false;"></a></div>
	<input type="text" value="0" readonly="readonly" name="linkurl">
	<a class="share_copy font_neo" href="javascript:void(0)">Copy Direct Link</a>
	<h3></h3>
	<input type="hidden" name="myemail">
	<h3 style="margin-top: -5px; font-size: 12px; line-height: 40px;">To E-mail</h3>
	<input type="text" name="toemail">
	<textarea>http://dev.intelsalesadvisor.com/newisa/publicindex/asset/id/</textarea>
	<input width="224" height="26" type="button"  class="send font_neo" value="Send">
</div>
<!--share end-->

<script type="text/javascript" charset="utf-8">

$('.share .send').click(function(){
	if (!USER_ID) {
		show_msg('you must login to share');
		return false;
	}
  var p = $(this).parents('.share');
  var content = $('textarea',p).val();
	var email = $('input[name=toemail]',p).val();
	var info = {};
	
	if (!checkEmail(email)) {
		show_msg('email address error');
    return false;
  }

	info['content'] = content;
	info['email'] = email;
	$.post(SITE_URL+'/send_mail.html', info, function(){
		$('.share_close a').click();
	});
});

$('.share .share_copy').click(function(){
	var p = $(this).parents('.share');
  var linkurl = $("input[name=linkurl]", p);
	copyToClipBoard(linkurl.val());
});


function share_link(url) {
  $('.share', p).hide();
  $('#sharePanel input[name=linkurl]').val(url);
  $('#sharePanel textarea').val(url);
  p.parent().css('position', '');
  
  $('#sharePanel').popShow({ closeId:"shareClose",titleId:"shareMessage"});
}

</script>

<!--share start-->
<div style="display:none" class="save_queue" id="save_queue">
  	<div class="clearfix">	
  		<h4 class="msg" id="shareMessage">Save My Queue</h4>
		<div class="share_close"><a href="#" id="save_queue_close" onclick="return false;"></a></div>
	</div>
	<h5 style="font-size: 12px; line-height: 40px;">Queue Name:</h5>
	<input type="text" name="save_queue_name" />
	<input type="hidden" name="save_queue_files" />
	<h5 style="font-size: 12px; line-height: 40px;">Queue Description:</h5>
	<textarea></textarea>
	<input width="224" height="26" type="button"  class="send font_neo save_queue_btu" value="Save" />
</div>
<!--share end-->
<script type="text/javascript" charset="utf-8">
function save_queue (op) {
	$('#save_queue input[name=save_queue_files]').val(op);
	p.parent().css('position', '');
  
  $('#save_queue').popShow({ closeId:"save_queue_close",titleId:"shareMessage"});
}

$(".save_queue_btu").click(function(){
  if (!USER_ID) {
		show_msg('you must be logged in to use this');
		return false;
	}
	var files = $('#save_queue input[name=save_queue_files]').val();
	var name = $('#save_queue input[name=save_queue_name]').val();
	var description = $('#save_queue textarea').val();
	var info = {};
	info['description'] = description;
	info['name'] = name;
	info['files'] = files;
	$.post(SITE_URL+'/user/my_saved_queues/add.html', info, function(){
		$('.share_close a').click();
	});
});


if (!USER_ID) {
  $('.share input, .share textarea').attr('readonly', 'readonly');
}
</script>
